﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace BillingSystem
{
    public partial class FormNumberStat : Form
    {
        // Колонки соединений
        DataGridViewTextBoxColumn cONNECTIONDATEDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
        DataGridViewTextBoxColumn tARGETPREFIXDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
        DataGridViewTextBoxColumn tARGETNUMBERDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
        DataGridViewTextBoxColumn dURATIONDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
        DataGridViewTextBoxColumn cOSTDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
        // BindingSource соединений 
        BindingSource cONNECTIONSBindingSource;
       

        public FormNumberStat()
        {
            InitializeComponent();
        }

        private void InitGrid(BindingSource bs) 
        {
             cONNECTIONSBindingSource = bs;

             // 
             // cONNECTIONDATEDataGridViewTextBoxColumn
             // 
             cONNECTIONDATEDataGridViewTextBoxColumn.DataPropertyName = "CONNECTION_DATE";
             cONNECTIONDATEDataGridViewTextBoxColumn.HeaderText = "Дата";
             cONNECTIONDATEDataGridViewTextBoxColumn.Name = "cONNECTIONDATEDataGridViewTextBoxColumn";
             cONNECTIONDATEDataGridViewTextBoxColumn.ReadOnly = true;
             // 
             // tARGETPREFIXDataGridViewTextBoxColumn
             // 
             tARGETPREFIXDataGridViewTextBoxColumn.DataPropertyName = "TARGET_PREFIX";
             tARGETPREFIXDataGridViewTextBoxColumn.HeaderText = "Код";
             tARGETPREFIXDataGridViewTextBoxColumn.Name = "tARGETPREFIXDataGridViewTextBoxColumn";
             tARGETPREFIXDataGridViewTextBoxColumn.ReadOnly = true;
             // 
             // tARGETNUMBERDataGridViewTextBoxColumn
             // 
             tARGETNUMBERDataGridViewTextBoxColumn.DataPropertyName = "TARGET_NUMBER";
             tARGETNUMBERDataGridViewTextBoxColumn.HeaderText = "Номер";
             tARGETNUMBERDataGridViewTextBoxColumn.Name = "tARGETNUMBERDataGridViewTextBoxColumn";
             tARGETNUMBERDataGridViewTextBoxColumn.ReadOnly = true;
             // 
             // dURATIONDataGridViewTextBoxColumn
             // 
             dURATIONDataGridViewTextBoxColumn.DataPropertyName = "DURATION";
             dURATIONDataGridViewTextBoxColumn.HeaderText = "Длительность";
             dURATIONDataGridViewTextBoxColumn.Name = "dURATIONDataGridViewTextBoxColumn";
             dURATIONDataGridViewTextBoxColumn.ReadOnly = true;
             // 
             // cOSTDataGridViewTextBoxColumn
             // 
             cOSTDataGridViewTextBoxColumn.DataPropertyName = "COST";
             cOSTDataGridViewTextBoxColumn.HeaderText = "Стоимость";
             cOSTDataGridViewTextBoxColumn.Name = "cOSTDataGridViewTextBoxColumn";
             cOSTDataGridViewTextBoxColumn.ReadOnly = true;

             dataGridView1.MultiSelect = false;
             dataGridView1.ReadOnly = true;
             dataGridView1.RowHeadersVisible = false;
             dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
             dataGridView1.AllowUserToAddRows = false;
             dataGridView1.AllowUserToDeleteRows = false;
             dataGridView1.AllowUserToResizeRows = false;
             dataGridView1.AutoGenerateColumns = false;
             dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             cONNECTIONDATEDataGridViewTextBoxColumn,
             tARGETPREFIXDataGridViewTextBoxColumn,
             tARGETNUMBERDataGridViewTextBoxColumn,
             dURATIONDataGridViewTextBoxColumn,
             cOSTDataGridViewTextBoxColumn});
             dataGridView1.DataSource = cONNECTIONSBindingSource;
             
        }

        


        public bool ShowForm(BindingSource bs_connections)
        {
            InitGrid(bs_connections);

            if (ShowDialog() == DialogResult.OK)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

    }
}
